#!/bin/sh
#
# Entropy Log Analyzer
#
# Original idea and code by Rescue
# Highly original name by NightBlade   :-)
#
# This script is intended to analyze entropy logs which
# are set to error or normal detail (in entropy.conf).
# However, some minor loglevel messages will also
# be checked for.
#
# Have an idea for this? Post it to the entropy forum!
#
# If this script doesn't execute, try issuing:
# "chmod +x loganalyze.sh"
#
# Left out:
# PNG.c errors 
# anything that executes a call to die
# Unicode.c errors (other than UTF8 news)
#
# set your log file if it's non-standard
logfile="entropy_rsa.log"

if [ ! -e ${logfile} ] ; then echo "==> Error: Unable to locate logfile:"${logfile}"!"; exit -1; fi;

echo "==> Running the Entropy Log Analyzer..."

#
# Begin data collection
#
# number of boards found 
boards=`grep -ics "found board" ${logfile}`

# number of messages found
msgs=`grep -ics "found message" ${logfile}`

# number of node fingerprints
fingerprints=`grep -ics "Got fingerprint info" ${logfile}`

# number of unknown hostnames
unknownhosts=`grep -ics "hostname .* not found" ${logfile}`

# number of node maintenance cycles
maintenances=`grep -ics "running node maintenance" ${logfile}`

# number of unattended INS
unattended=`grep -ics "Unattended INS" ${logfile}`

# number of invalid types
invalid_types=`grep -ics "invalid type" ${logfile}`

# number of invalid keys
invalid_keys=`grep -ics "invalid key" ${logfile}`

# number of connection resets
connection_resets=`grep -ics "Connection reset" ${logfile}`

# number of time outs
time_outs=`grep -ics "timed out" ${logfile}`

# number of times we shutdown incoming connections due to inactivity
shutdowns=`grep -ics "shutdown" ${logfile}`

# number of times we were blown off by a busy node
refused=`grep -ics "Connection refused" ${logfile}`

# number of times we have unknown commands. Potential hacker alert!
unknown_commands=`grep -ics "unknown command" ${logfile}`

# number of times we failed zapping keys
failed_zaps=`grep -ics "zapping key" ${logfile}`

# number of times we zapped keys
good_zaps=`grep -ics "zapped key" ${logfile}`

# number of times we invalid pub keys
io_errors=`grep -ics "Input/output error" ${logfile}`

# number of times we tried to free a null pointer
mem_frees=`grep -ics "attempt to free unallocated memory" ${logfile}`

# number of times we were contacted by a Freenet node (silly people)
broken_pipes=`grep -ics "Broken pipe" ${logfile}`

# number of times we started Entropy in this log
estarts=`grep -ics "****** startup ******" ${logfile}`

# number of times we have bad file descriptors
bad_descriptors=`grep -ics "Bad file descriptor" ${logfile}`

# number of times we had a process crash
no_processes=`grep -ics "is dead (No such process)" ${logfile}`

# number of times we had to boot a downlevel Entropy node
old_nodes=`grep -ics "kicking it off" ${logfile}`

# number of times we couldn't locate a message
no_msgs=`grep -ics "did not find msg" ${logfile}`

# number of times we had a successful insert
good_inserts=`grep -ics "successfully inserted" ${logfile}`

# number of times we failed to insert a redirect
bad_redirects=`grep -ics "failed to insert redirect" ${logfile}`

# number of times we failed to insert a MYSQL row for a key
bad_row=`grep -ics "failed to insert row for key" ${logfile}`

# number of times we failed to squeeze an LZW file
failed_squeeze=`grep -ics "failed to lzw_squeeze" ${logfile}`

# number of times we failed to expand an LZW file
failed_expand=`grep -ics "failed to lzw_expand" ${logfile}`

# number of times we failed to put() to the store
failed_put=`grep -ics "store_put() call failed" ${logfile}`

# number of times we failed on a peer_adv_wait call
failed_peer_wait=`grep -ics "peer_adv_wait() call failed" ${logfile}`

# number of times we failed read from temp
failed_temp_read=`grep -ics "temp_read() from" ${logfile}`

# number of times we failed expand files
failed_file_expand=`grep -ics "file_expand(.*) failed" ${logfile}`

# number of times we failed to lock g_news
failed_g_news=`grep -ics "locking g_news failed" ${logfile}`

# number of times we failed to decode news
failed_news_decode=`grep -ics "news_utf8_decode() call failed" ${logfile}`

# number of times we failed to complete news sstrdup.
failed_sstrdup=`grep -ics "sstrdup() call failed" ${logfile}`

# number of times we failed to put a file
failed_file_put_retry=`grep -ics "file_put_retry() call failed" ${logfile}`

# number of times we failed to sscalloc news or proxy
failed_sscalloc=`grep -ics "failed to scalloc()" ${logfile}`

# number of times we failed to lock g_proc
failed_g_proc=`grep -ics "locking g_proc failed" ${logfile}`

# number of times we failed to lock g_peer
failed_g_peer=`grep -ics "g_peer lock failed" ${logfile}`

# number of times we failed to put a key
failed_file_put=`grep -ics "file_put() for key" ${logfile}`

# number of times we failed to parse XML from a peer
failed_XML=`grep -ics "XML_ParserCreate() failed" ${logfile}`

# number of times we failed the initial squeeze call
failed_initial_squeeze=`grep -ics "initial lzw_squeeze() call failed" ${logfile}`

# number of times we failed to send the initial peer_out msg
failed_initial_peer_out_msg=`grep -ics "initial peer_out_msg() call failed" ${logfile}`

# number of times we failed peer select call
failed_peer_select=`grep -ics "select() call failed" ${logfile}`

# number of times we failed to send the  peer_out msg
failed_peer_out_msg=`grep -ics "peer_out_msg() call failed" ${logfile}`
# I don't know of way to tell grep to do this is all in one line
if [ "${failed_peer_out_msg}" -gt "0" ] ; then
failed_peer_out_msg=$((${failed_peer_out_msg}-${failed_initial_peer_out_msg}))
fi

# number of times we failed the stream2msg call
failed_stream2msg=`grep -ics "stream2msg() call failed" ${logfile}`

# number of times we failed to add a peer
failed_peer_add_entry=`grep -ics "peer_add_entry() call failed!" ${logfile}`

# number of times we failed to generate a McElise key
failed_mce_generate=`grep -ics "mce_generate() call failed" ${logfile}`

# number of times we failed to get the initial peer_in msg
failed_initial_peer_in_msg=`grep -ics "initial peer_in_msg() call failed" ${logfile}`

# number of times we failed the initial expand msg call
failed_initial_expand_msg=`grep -ics "lzw_expand() initial message call failed!" ${logfile}`

# number of times we failed to get a random key for the dummy fingerprint
failed_rnd_get=`grep -ics "rnd_get() dummy fingerprint failed" ${logfile}`

# number of times we failed to get the peer_in msg
failed_peer_in_msg=`grep -ics "peer_in_msg() call from" ${logfile}`

# number of times we failed to set the peer timer
failed_setitimer=`grep -ics "setitimer() call failed" ${logfile}`

# number of times we failed to delete from the store
failed_del=`grep -ics "store_del() call failed" ${logfile}`

# number of times we failed to lock g_proxy
failed_g_proxy=`grep -ics "locking g_proxy failed" ${logfile}`

# number of times we failed to send something via the proxy
failed_send=`grep -ics "failed to send" ${logfile}`

# number of times we failed accept a socket
failed_socket_accept=`grep -ics "accept() call failed" ${logfile}`

# number of times we optimized the SQL store
sql_optimize=`grep -ics "optimizing store" ${logfile}`

# number of times we optimized the SQL store and failed
sql_optimize_failed=`grep -ics "optimize table failed" ${logfile}`

# number of times we optimized the SQL store and failed
sql_optimize_failed=`grep -ics "optimize table failed" ${logfile}`

# number of dead procs
dead_procs=`grep -ics "proc {.*} is dead" ${logfile}`

# number of dead peers
dead_peers=`grep -ics "dead peer" ${logfile}`

# number of null times lzwbuff is null
null_lzwbuff=`grep -ics "lzwbuff is NULL" ${logfile}`

# number of null times lzwoffs is out of bounds
oob_lzwoffs=`grep -ics "lzwoffs out of bounds" ${logfile}`

# number of failed file_gets
failed_file_get=`grep -ics "file_get(.*) call failed" ${logfile}`

# number of good connection setups - outbound
good_connection_setups_to=`grep -ics "connection setup to .* succeeded" ${logfile}`

# number of failed connection setups - outbound
failed_connection_setups_to=`grep -ics "connection setup to .* failed" ${logfile}`

# number of good connection setups - inbound
good_connection_setups_from=`grep -ics "connection setup from .* succeeded" ${logfile}`

# number of failed connection setups - inbound
failed_connection_setups_from=`grep -ics "connection setup from .* failed" ${logfile}`

# number of bogus things (bytes, bytes decrypted, and bogus msg) we spotted, consolidated
bogus=`grep -ics "bogus" ${logfile}`

# number of keys not found (mysql, store tree, and file)
keys_not_found=`grep -ics "key .* not found" ${logfile}`

# number of new day alerts.
new_days=`grep -ics "NEW DAY" ${logfile}`

# number of MSG_FEC enqueues
MSG_FEC_enqueues=`grep -ics "MSG_FEC .* enqueued as" ${logfile}`

# number of MSG_FEC failures
MSG_FEC_failed=`grep -ics "MSG_FEC .* failed" ${logfile}`

# number of MSG_FEC successes
MSG_FEC_succeeded=`grep -ics "MSG_FEC .* succeeded" ${logfile}`

# number of times we failed to lock the store
failed_store_lock=`grep -ics "locking store failed" ${logfile}`

# number of changes to the config file we've noticed
config_change=`grep -ics "config file change detected" ${logfile}`

# number of changes to the config file we've noticed
config_not_found=`grep -ics "config file .* not found" ${logfile}`

# number of times peer recons set failed
peer_recons_set=`grep -ics "peer_recons_set(.*) failed" ${logfile}`

# number of bad fragment chuncks
bad_chunks=`grep -ics "fragment chunk .* bad" ${logfile}`

# number of sock.c EINTR errors
eintr=`grep -ics "EINTR" ${logfile}`

# number of times a connect call to a specific hostname failed
hostname_connect_failed=`grep -ics "connect(.*), hostname .* call failed" ${logfile}`

# number of times a listen call failed
listen_failed=`grep -ics "listen(.*) call failed" ${logfile}`

# number of times a bind call failed
bind_failed=`grep -ics "bind(.*) call failed" ${logfile}`

# number of times a socket was shut down
socket_shutdown=`grep -ics "socket was shut down" ${logfile}`

# number of osd_recv failures
osd_recv_failed=`grep -ics "osd_recv(.*) failed" ${logfile}`

# number of setsockopt (set sock options) failures
setsockopt_failed=`grep -ics "setsockopt(.*) call failed" ${logfile}`

# number of osd_ssocket failures
osd_recv_failed=`grep -ics "osd_socket(.*) failed" ${logfile}`

# number of osd_fcntl3 failures
osd_fcntl3_failed=`grep -ics "osd_fcntl3(.*) call failed" ${logfile}`

# number of invalid ports
invalid_ports=`grep -ics "invalid port" ${logfile}`

# number of failed semget calls
semget_failed=`grep -ics "semget(.*) failed" ${logfile}`

# number of failed calloc calls
calloc_failed=`grep -ics "calloc(.*) call failed" ${logfile}`

# number of failed osd open calls
osd_open_failed=`grep -ics "open(.*) call failed" ${logfile}`

# number of failed sock_writeall calls
sock_writeall_failed=`grep -ics "sock_writeall(.*) to peer .* failed" ${logfile}`

# number of failed sock_readall calls
sock_readall_failed=`grep -ics "sock_readall(.*) to peer .* failed" ${logfile}`

# number of invalid redirects
invalid_redirects=`grep -ics "invalid redirect" ${logfile}`

# number of g_peer_out_pids which are invalid
g_peer_out_pid_invalid=`grep -ics "g_peer_out_pid is invalid" ${logfile}`

# number of g_peer_bwlimit_pids which are invalid
g_peer_bwlimit_pid_invalid=`grep -ics "g_peer_bwlimit_pid is invalid" ${logfile}`

# number of g_peer_threads_pids which are invalid
g_peer_threads_pid_invalid=`grep -ics "g_peer_threads_pid is invalid" ${logfile}`

# number of times we failed to lock g_peer for fec
failed_g_peer_fec=`grep -ics "g_peer fec lock failed" ${logfile}`

# number of g_peer_pids which are invalid
g_peer_pid_invalid=`grep -ics "g_peer_pid is invalid" ${logfile}`

# number of g_peer sems which are shutdown
g_peer_sems_shutdown=`grep -ics "shutdown g_peer sems" ${logfile}`

# number of g_peer_fec_worker_pids which are invalid
g_peer_fec_worker_pid_invalid=`grep -ics "g_peer_fec_worker_pid is invalid" ${logfile}`

# number of resource unavailables
resource_unavailable=`grep -ics "Resource temporarily unavailable" ${logfile}`

# number of interrupted system calls
interrupted=`grep -ics "failed (Interrupted system call)" ${logfile}`

# number of invalid fingerprints
invalid_fingerprint=`grep -ics "invalid fingerprint" ${logfile}`

#
# Analysis complete.  ...and the results are:
#
echo "==> Analysis Complete."
echo " "

#
echo "The logfile shows "${estarts}" unique Entropy startup(s) and "${new_days}" 'New Day' notices."
echo " "

# normal messages
if [ "${boards}" -gt "0" ] ; then echo "Normal: Found "${boards}" news board(s)."; fi;
if [ "${msgs}" -gt "0" ] ; then echo "Normal: Found "${msgs}" news article(s)."; fi;
if [ "${fingerprints}" -gt "0" ] ; then echo "Normal: Found "${fingerprints}" node fingerprint(s). We use fingerprints for integrity and for 'noise'."; fi;
if [ "${maintenances}" -gt "0" ] ; then echo "Normal: Found "${maintenances}" node maintenance execution(s)."; fi;
if [ "${shutdowns}" -gt "0" ] ; then echo "Normal: Found "${shutdowns}" connection shutdown(s)."; fi;
if [ "${good_inserts}" -gt "0" ] ; then echo "Normal: Found "${good_inserts}" good insert(s)."; fi;
if [ "${sql_optimize}" -gt "0" ] ; then echo "Normal: Found "${sql_optimize}" SQL table optimization execution(s)."; fi;
if [ "${good_connection_setups_to}" -gt "0" ] ; then echo "Normal: Found "${good_connection_setups_to}" successful outbound connection setup(s)."; fi;
if [ "${good_connection_setups_from}" -gt "0" ] ; then echo "Normal: Found "${good_connection_setups_from}" successful inbound connection setup(s)."; fi;
if [ "${MSG_FEC_enqueues}" -gt "0" ] ; then echo "Normal: Found "${MSG_FEC_enqueues}" MSG_FEC enqueue(s)."; fi;
if [ "${MSG_FEC_succeeded}" -gt "0" ] ; then echo "Normal: Found "${MSG_FEC_succeeded}" MSG_FEC success(es)."; fi;
if [ "${config_change}" -gt "0" ] ; then echo "Normal: Found "${config_change}" config file change(s)."; fi;
if [ "${g_peer_sems_shutdown}" -gt "0" ] ; then echo "Normal: Found "${g_peer_sems_shutdown}" g_peer sems shutdown(s)."; fi;

# warnings
echo " "
if [ "${unknownhosts}" -gt "0" ] ; then echo "Warning: Found "${unknownhosts}" call(s) to unknown host(s)."; fi;
if [ "${unattended}" -gt "0" ] ; then echo "Warning: Found "${unattended}" unattended insert(s)."; fi;
if [ "${invalid_types}" -gt "0" ] ; then echo "Warning: Found "${invalid_types}" invalid type(s)."; fi;
if [ "${invalid_keys}" -gt "0" ] ; then echo "Warning: Found "${invalid_keys}" invalid key(s)."; fi;
if [ "${good_zaps}" -gt "0" ] ; then echo "Warning: Found "${good_zaps}" zap(s) of invalid key(s)."; fi;
if [ "${io_errors}" -gt "0" ] ; then echo "Warning: Found "${io_errors}" McEliece public key failure(s). Aren't you glad we checked? :-)"; fi;
if [ "${broken_pipes}" -gt "0" ] ; then echo "Warning: Found "${broken_pipes}" broken pipe(s). This is (mostly) a by-product of the connection algorithm. Don't worry about these."; fi;
if [ "${old_nodes}" -gt "0" ] ; then echo "Warning: Booted "${old_nodes}" node(s) running downlevel Entropy code."; fi;
if [ "${no_msgs}" -gt "0" ] ; then echo "Warning: Unable to retreive "${no_msgs}" news article(s)."; fi;
if [ "${failed_file_put_retry}" -gt "0" ] ; then echo "Warning: Unable to file_put_retry "${failed_file_put_retry}" items(s)."; fi;
if [ "${failed_file_get}" -gt "0" ] ; then echo "Warning: Unable to file_get "${failed_file_get}" items(s). A high number (in the thousands) may indicate an insufficient number of incoming peers or your bandwidth limit is too low."; fi;
if [ "${failed_connection_setups_to}" -gt "0" ] ; then echo "Warning: Found "${failed_connection_setups_to}" failed outbound connection setup(s)."; fi;
if [ "${failed_connection_setups_from}" -gt "0" ] ; then echo "Warning: Found "${failed_connection_setups_from}" failed inbound connection setup(s)."; fi;
if [ "${keys_not_found}" -gt "0" ] ; then echo "Warning: Found "${keys_not_found}" key(s) not found in our store! Some number are to be expected from the intentional 'noise' code."; fi;
if [ "${MSG_FEC_failed}" -gt "0" ] ; then echo "Warning: Found "${MSG_FEC_failed}" MSG_FEC failure(s). As long as you generally have some successes, this number is not terribly important."; fi;
if [ "${peer_recons_set}" -gt "0" ] ; then echo "Warning: Found "${peer_recons_set}" peer_recons_set failure(s)."; fi;
if [ "${bad_chunks}" -gt "0" ] ; then echo "Warning: Found "${bad_chunks}" bad fragment chunks."; fi;
if [ "${eintr}" -gt "0" ] ; then echo "Warning: Found "${eintr}" sock EINTR errors."; fi;
if [ "${hostname_connect_failed}" -gt "0" ] ; then echo "Warning: Found "${hostname_connect_failed}" failed connect(s) to a specific hostname."; fi;
if [ "${listen_failed}" -gt "0" ] ; then echo "Warning: Found "${listen_failed}" failed listen call(s)."; fi;
if [ "${bind_failed}" -gt "0" ] ; then echo "Warning: Found "${bind_failed}" failed bind calls."; fi;
if [ "${socket_shutdown}" -gt "0" ] ; then echo "Warning: Found "${socket_shutdown}" socket shutdown(s)."; fi;
if [ "${osd_recv_failed}" -gt "0" ] ; then echo "Warning: Found "${osd_recv_failed}" osd_recv failure(s)."; fi;
if [ "${setsockopt_failed}" -gt "0" ] ; then echo "Warning: Found "${setsockopt_failed}" setsockopt failure(s)."; fi;
if [ "${osd_recv_failed}" -gt "0" ] ; then echo "Warning: Found "${osd_recv_failed}" osd_recv failure(s)."; fi;
if [ "${osd_fcntl3_failed}" -gt "0" ] ; then echo "Warning: Found "${osd_fcntl3_failed}" osd_fcntl3 failure(s)."; fi;
if [ "${invalid_ports}" -gt "0" ] ; then echo "Warning: Found "${invalid_ports}" invalid port(s)."; fi;
if [ "${connection_resets}" -gt "0" ] ; then echo "Warning: Found "${connection_resets}" connection reset(s). This is (mostly) a by-product of the connection algorithm. Don't worry about these."; fi;
if [ "${connection_resets}" -gt 200 ] ; then echo "==> Info: "${connection_resets}" connection resets is quite unusual."; fi;
if [ "${time_outs}" -gt "0" ] ; then echo "Warning: Found "${time_outs}" connection time out(s)."; fi;
if [ "${time_outs}" -gt 60 ] ; then echo "==> Info: "${time_outs}" connection time outs is quite unusual."; fi;
if [ "${refused}" -gt "0" ] ; then echo "Warning: Found "${refused}" refused connection(s)."; fi;
if [ "${refused}" -gt "0" ] && [ ${refused} -lt 60 ] 
 then 
    echo "==> Info: "${refused}" refused connections indicates low network traffic. This is normal."
    elif [ "${refused}" -gt 60 ] && [ "${refused}" -lt 90 ] 
        then 
            echo "==> Info: "${refused}" refused connections indicates medium network traffic or your node doesn't have enough peers. Consider adding more seed nodes in the seed.txt file."
            elif [ "${refused}" -gt 90 ]
                then echo "==> Info: "${refused}" refused connections indicates high network traffic or your node doesn't have enough peers. Consider adding more seed nodes in the seed.txt file."
fi
if [ "${semget_failed}" -gt "0" ] ; then echo "Warning: Found "${semget_failed}" semget failure(s)."; fi;
if [ "${calloc_failed}" -gt "0" ] ; then echo "Warning: Found "${calloc_failed}" calloc failure(s)."; fi;
if [ "${osd_open_failed}" -gt "0" ] ; then echo "Warning: Found "${osd_open_failed}" osd open failure(s)."; fi;
if [ "${sock_writeall_failed}" -gt "0" ] ; then echo "Warning: Found "${sock_writeall_failed}" sock_writeall failure(s)."; fi;
if [ "${sock_readall_failed}" -gt "0" ] ; then echo "Warning: Found "${sock_readall_failed}" sock_readall failure(s)."; fi;
if [ "${invalid_redirects}" -gt "0" ] ; then echo "Warning: Found "${invalid_redirects}" invalid redirect(s)."; fi;
if [ "${resource_unavailable}" -gt "0" ] ; then echo "Warning: Found "${resource_unavailable}" resource temporarily unavailable message(s). This number means your peers are busy."; fi;
if [ "${interrupted}" -gt "0" ] ; then echo "Warning: Found "${interrupted}" interrupted system call (node <-> node) message(s). How rude! :-)"; fi;

# errors
echo " "
if [ "${mem_frees}" -gt "0" ] ; then echo "Error: Found "${mem_frees}" attempt(s) to free a null pointer! Please report this to the Entropy forum."; fi;
if [ "${unknown_commands}" -gt "0" ] ; then echo "Error: Found "${unknown_commands}" unknown command(s)! You might be under a hacker attack!!! Please report this to the Entropy forum."; fi;
if [ "${bad_descriptors}" -gt "0" ] ; then echo "Error: Found "${bad_descriptors}" bad file descriptor(s)! Please report this to the Entropy forum."; fi;
if [ "${no_processes}" -gt "0" ] ; then echo "Error: Found "${no_processes}" crashed process(es)! Please check your system logs and report this to the Entropy forum."; fi;
if [ "${bad_redirects}" -gt "0" ] ; then echo "Error: Unable to insert "${no_msgs}" redirect(s)."; fi;
if [ "${bad_row}" -gt "0" ] ; then echo "Error: Unable to insert "${bad_row}" row(s) for key(s)."; fi;
if [ "${failed_squeeze}" -gt "0" ] ; then echo "Error: Failed to LZW Squeeze "${failed_squeeze}" item(s)."; fi;
if [ "${failed_expand}" -gt "0" ] ; then echo "Error: Failed to LZW Expand "${failed_expand}" item(s)."; fi;
if [ "${failed_put}" -gt "0" ] ; then echo "Error: Failed to write to store "${failed_put}" item(s). There is a problem with your store or disk!"; fi;
if [ "${failed_peer_wait}" -gt "0" ] ; then echo "Error: Failed to wait for "${failed_peer_wait}" node(s)."; fi;
if [ "${failed_temp_read}" -gt "0" ] ; then echo "Error: Failed to read from temp "${failed_temp_read}" item(s). There is a problem with your store or disk!"; fi;
if [ "${failed_file_expand}" -gt "0" ] ; then echo "Error: Failed to expand "${failed_file_expand}" files(s)."; fi;
if [ "${failed_g_news}" -gt "0" ] ; then echo "Error: Failed to lock g_news "${failed_g_news}" time(s)."; fi;
if [ "${failed_news_decode}" -gt "0" ] ; then echo "Error: Failed to UTF8 decode "${failed_news_decode}" news item(s)."; fi;
if [ "${failed_sstrdup}" -gt "0" ] ; then echo "Error: Failed to complete news sstrdup "${failed_sstrdup}" times(s)."; fi;
if [ "${failed_sscalloc}" -gt "0" ] ; then echo "Error: Failed to complete news or peer sscalloc "${failed_sscalloc}" times(s)."; fi;
if [ "${failed_g_proc}" -gt "0" ] ; then echo "Error: Failed to lock OSD g_proc "${failed_g_proc}" times(s)."; fi;
if [ "${failed_g_peer}" -gt "0" ] ; then echo "Error: Failed to lock g_peer "${failed_g_peer}" times(s)."; fi;
if [ "${failed_file_put}" -gt "0" ] ; then echo "Error: Failed to file_put "${failed_file_put}" key(s)."; fi;
if [ "${failed_XML}" -gt "0" ] ; then echo "Error: Failed to process "${failed_XML}" peer XML item(s)."; fi;
if [ "${failed_initial_squeeze}" -gt "0" ] ; then echo "Error: Initial Squeeze call failed "${failed_initial_squeeze}" times(s)."; fi;
if [ "${failed_initial_peer_out_msg}" -gt "0" ] ; then echo "Error: Initial peer_out_msg call failed "${failed_initial_peer_out_msg}" time(s)."; fi;
if [ "${failed_peer_select}" -gt "0" ] ; then echo "Error: Fail peer_select call "${failed_peer_select}" time(s)."; fi;
if [ "${failed_peer_out_msg}" -gt "0" ] ; then echo "Error: peer_out_msg call failed "${failed_peer_out_msg}" time(s)."; fi;
if [ "${failed_stream2msg}" -gt "0" ] ; then echo "Error: stream2msg call failed "${failed_stream2msg}" time(s)."; fi;
if [ "${failed_peer_add_entry}" -gt "0" ] ; then echo "Error: failed_peer_add_entry call failed "${failed_peer_add_entry}" time(s)."; fi;
if [ "${failed_mce_generate}" -gt "0" ] ; then echo "Error: McElise generate call failed "${failed_mce_generate}" time(s)."; fi;
if [ "${failed_initial_peer_in_msg}" -gt "0" ] ; then echo "Error: Initial peer_in_msg call failed "${failed_initial_peer_in_msg}" time(s)."; fi;
if [ "${failed_initial_expand_msg}" -gt "0" ] ; then echo "Error: Initial expand_msg call failed "${failed_initial_expand_msg}" time(s)."; fi;
if [ "${failed_rnd_get}" -gt "0" ] ; then echo "Error: Failed to generate random number for dummy fingerprint "${failed_rnd_get}" time(s)."; fi;
if [ "${failed_peer_in_msg}" -gt "0" ] ; then echo "Error: peer_in_msg call failed "${failed_peer_in_msg}" time(s)."; fi;
if [ "${failed_setitimer}" -gt "0" ] ; then echo "Error: setitimer call failed "${failed_setitimer}" time(s)."; fi;
if [ "${failed_del}" -gt "0" ] ; then echo "Error: Failed to delete from our store "${failed_del}" time(s).  You have may have problem with your store or disk!"; fi;
if [ "${failed_g_proxy}" -gt "0" ] ; then echo "Error: Failed to lock g_proxy "${failed_g_proxy}" time(s)."; fi;
if [ "${failed_send}" -gt "0" ] ; then echo "Error: I found "${failed_send}" error message(s) saying you failed to send something via the proxy.  You should investigate these errors."; fi;
if [ "${failed_socket_accept}" -gt "0" ] ; then echo "Error: Failed to accept a socket "${failed_socket_accept}" time(s)."; fi;
if [ "${sql_optimize_failed}" -gt "0" ] ; then echo "Error: Failed to optimize SQL store "${sql_optimize_failed}" time(s)."; fi;
if [ "${failed_zaps}" -gt "0" ] ; then echo "Error: Found "${failed_zaps}" failed zap(s) of invalid key(s)!"; fi;
if [ "${dead_procs}" -gt "0" ] ; then echo "Error: Found "${dead_procs}" dead proc(s)! Please report this to the Entropy forum."; fi;
if [ "${dead_peers}" -gt "0" ] ; then echo "Error: Found "${dead_peers}" dead peer(s)! Please report this to the Entropy forum."; fi;
if [ "${null_lzwbuff}" -gt "0" ] ; then echo "Error: Found "${null_lzwbuff}" time(s) that LZWBUFF was NULL! Please report this to the Entropy forum."; fi;
if [ "${oob_lzwoffs}" -gt "0" ] ; then echo "Error: Found "${oob_lzwoffs}" time(s) that LZWOFFS was Out of Bounds! Please report this to the Entropy forum."; fi;
if [ "${bogus}" -gt "0" ] ; then echo "Error: Found "${bogus}" bogus error message(s). This is most likely due to a node using a downlevel version."; fi;
if [ "${failed_store_lock}" -gt "0" ] ; then echo "Error: Found "${failed_store_lock}" failed attempt(s) to lock the store! Please report this to the Entropy forum."; fi;
if [ "${config_not_found}" -gt "0" ] ; then echo "Error: Found "${config_not_found}" config file not found error(s). Please investigate."; fi;
if [ "${g_peer_out_pid_invalid}" -gt "0" ] ; then echo "Error: Found "${g_peer_out_pid_invalid}" g_peer_out_pid error(s)."; fi;
if [ "${g_peer_bwlimit_pid_invalid}" -gt "0" ] ; then echo "Error: Found "${g_peer_bwlimit_pid_invalid}" g_peer_bwlimit_pid error(s)."; fi;
if [ "${g_peer_threads_pid_invalid}" -gt "0" ] ; then echo "Error: Found "${g_peer_threads_pid_invalid}" g_peer_thread_pid error(s)."; fi;
if [ "${failed_g_peer_fec}" -gt "0" ] ; then echo "Error: Failed to lock g_peer for fec "${failed_g_peer_fec}" times(s)."; fi;
if [ "${g_peer_pid_invalid}" -gt "0" ] ; then echo "Error: Found "${g_peer_pid_invalid}" g_peer_pid error(s)."; fi;
if [ "${g_peer_fec_worker_pid_invalid}" -gt "0" ] ; then echo "Error: Found "${g_peer_fec_worker_pid_invalid}" g_peer_fec_worker_pid error(s)."; fi;
if [ "${invalid_fingerprint}" -gt "0" ] ; then echo "Error: Found "${invalid_fingerprint}" invalid fingerprint error(s)."; fi;
echo "===> End Report."
